//package com.onLineCar.dispatch.config;
//
//import org.springframework.amqp.core.AcknowledgeMode;
//import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
//import org.springframework.amqp.rabbit.connection.ConnectionFactory;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.autoconfigure.amqp.SimpleRabbitListenerContainerFactoryConfigurer;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class RabbitMqConfig {
//    @Bean("customContainerFactory")
//    public SimpleRabbitListenerContainerFactory containerFactory(SimpleRabbitListenerContainerFactoryConfigurer configurer,
//                                                                 @Qualifier("myConnectionFactory") ConnectionFactory connectionFactory) {
//        SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
//
//        factory.setConnectionFactory(connectionFactory);
//        //初始化消费者数量
//        factory.setConcurrentConsumers(4);
//        //最大消费者数量
//        factory.setMaxConcurrentConsumers(4);
//        //手动确认消息
//        factory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
//        // 单个消费者一次接收的消息数，默认250
//        factory.setPrefetchCount(10);
//        configurer.configure(factory,connectionFactory);
//        return factory;
//    }
//}
